<%@ page language="java" errorPage="/error.jsp" pageEncoding="utf-8" contentType="text/html;charset=utf-8"%>
<%@ include file="/common/taglibs.jsp"%>
<%@ page language="java" import="com.fish.anne.service.SystemRegionManager" import="org.springframework.web.context.support.WebApplicationContextUtils"
import="org.springframework.context.ApplicationContext" 
import="com.fish.anne.model.SystemRegion"   isErrorPage="true"
import="com.fish.anne.webapp.util.DateTimeFormatUtil"
import="com.fish.anne.webapp.formbean.*"
import="com.fish.anne.service.AutoManager"
import="com.fish.anne.model.Auto"
import="java.util.*"  %>

<%

ApplicationContext ctx =
            WebApplicationContextUtils.getRequiredWebApplicationContext(request.getSession().getServletContext());
SystemRegionManager ssm = (SystemRegionManager)ctx.getBean("systemRegionManager");
AutoManager autoManager = (AutoManager)ctx.getBean("autoManager");

List<Auto> autoes = autoManager.findCheapAutos();
request.setAttribute("autoes",autoes); 
List<SystemRegion> systemRegions = ssm.getAll();
	
request.setAttribute("systemRegions",systemRegions);
Date day = new Date();
		Date other = DateTimeFormatUtil.addTimeByDays(day,3);
		String today = DateTimeFormatUtil.convertDateToString(day, DateTimeFormatUtil.YEAR_MONTH_DAY_TEMPLATE_1);
		String _other = DateTimeFormatUtil.convertDateToString(other, DateTimeFormatUtil.YEAR_MONTH_DAY_TEMPLATE_1);
		
	FrontAutoSearch search = new FrontAutoSearch();
	search.setBeginDate(today);
	search.setEndDate(_other);
request.setAttribute("frontAutoSearch",search);
 %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
	<head>
		<title></title>
		<%@ include file="/jsp/front/common/header.jsp"%>

		<link rel="stylesheet"
			href="<c:url value='/scripts/themes/base/jquery.ui.all.css'/>"
			type="text/css" />
	</head>
	<body>
		<%@ include file="/jsp/front/common/nav.jsp"%>
		<div class="container">
			<div class="leftBar">
				<div class="t_block flightse">
					<div class="hd">
						<ul id="changeType" class="wrap">
							<li   class="active">
								<span> 车辆查询</span>
							</li>
							<li  >
								<span> &nbsp;</span>
							</li>
						</ul>
					</div>
					<div id="searchPanel" class="ct">
						<form action="auto_list.do"
							method="get" id="searchForm">
							<table cellpadding="0" cellspacing="0" class="tbl">
								<tbody>
									 
									<tr>
										<td>
											出发城市：
										</td>
										<td>
											<div class="">
												 
												 
												<select style="width:120px;" name="frontAutoSearch.from">
													<c:forEach var="region" items="${systemRegions}" varStatus="status1">
														<option <c:if test="${frontAutoSearch.from eq region.regionId}">selected="selected"</c:if> value="${region.regionId }"    >${region.localName} </option>
													</c:forEach>													
												</select>
													 
											</div>
										</td>
									</tr>
									<tr>
										<td>
											出发时间：
										</td>
										<td>
											<div class="">					 
												 <input id="_begin" name="frontAutoSearch.beginDate" value="${frontAutoSearch.beginDate}" />													 
											</div>
										</td>
									</tr>
									 <tr>
										<td>
											到达城市：
										</td>
										<td>
											<div class="   ">
												 
												 
												<select style="width:120px;" name="frontAutoSearch.to">
													<c:forEach var="region" items="${systemRegions}" varStatus="status1">
														<option <c:if test="${frontAutoSearch.from eq region.regionId }">selected="selected"</c:if> value="${region.regionId }"    >${region.localName} </option>
													</c:forEach>													
												</select>
													 
											</div>
										</td>
									</tr>
									<tr>
										<td>
											到达时间：
										</td>
										<td>
											<div class="">					 
												 <input id="_end" name="frontAutoSearch.endDate" value="${frontAutoSearch.endDate}" />													 
											</div>
										</td>
									</tr>
									 
									 
									<tr>
										<th>
											&nbsp;
										</th>
										<td>
											<input type="submit" value="搜 索" class="btn" />
										</td>
									</tr>
								</tbody>
							</table>
						</form>
					</div>
					
				</div>
				 
				<div class="t_block helpct">
					<%@ include file="/jsp/front/common/leftHelp.jsp"%>
				</div>
				
			</div>
			
			
			<div class="content">
				<div id="slider" class="t_slider" style="height: 285px;">
					<table>
						<tbody>
							<tr>
								<td>
									<img src="<c:url value='/theme/snow/images/index05.jpg'/>" width="675px" height="280px"
										style="cursor: pointer; display: inline;"/> 
								</td>
							</tr>
						</tbody>
					</table>
					 
				</div>
				 

				<div class="rcflight">
					<div class="t_block2 rcflight">
						<div class="hd">
							<div class="wrap">
								特价
							</div>
						</div> 
					</div>
				</div>
				<div id="flightList" class="list">
						<div class="hd">
							&nbsp;
						</div>
						<div class="flightPanel">
							<c:forEach var="auto" items="${autoes}" varStatus="status1">
								<form action="order_cart.do">
									<input type="hidden" name="frontAutoSearch.beginDate"
										value="${frontAutoSearch.beginDate }" />
									<input type="hidden" name="frontAutoSearch.from"
										value="${frontAutoSearch.from }" />
									<input type="hidden" name="frontAutoSearch.endDate"
										value="${frontAutoSearch.endDate }" />
									<input type="hidden" name="frontAutoSearch.to"
										value="${frontAutoSearch.to }" />
									<input type="hidden" name="autoId" value="${auto.autoId }" />
									<div id="flightListXI34" class="ct" style="z-index: 600">
										<div class="c2">

											<br />
											<img width="180px" height="130px"
												src="<c:url value='${auto.defaultPic}' />" />
											<br />

										</div>
										<div class="c4">
											&nbsp;

										</div>
										<div class="c2">
											<div  >
												<br />
												${auto.name} / ${auto.engine} / ${auto.gearbox}
												<br />
												<br />

												保险 : ${auto.insure}
											</div>
										</div>
										<div class="c4">
											&nbsp;

										</div>
										<div class="c2">
											<div class="pr">
												<br />

												<span>周一到周四 </span>
												<span style="margin-left: 30px;">¥${auto.price} </span>
												<br />
												<br />
												<span> 周五到周末 </span>
												<span style="margin-left: 30px;">
													¥${auto.weekendPrice} </span>
												<br />
												<br />
												<span> 法定节假日 </span>
												<span style="margin-left: 30px;">¥${auto.holidayPrice}
												</span>
												<br />
												<br />

											</div>

										</div>

										<div class="c3">
											<div class="pr">
											</div>

										</div>
										<div class="bb">
											<input type="submit" value="预订" style="padding:5px;" />
										</div>
									</div>
								</form>
							</c:forEach>
						</div>
					</div>
			</div>
		</div>

		

<script type="text/javascript"
			src="<c:url value='/scripts/jquery-1.4.2.js'/>"></script>
		<script type="text/javascript"
			src="<c:url value='/scripts/jquery.bgiframe-2.1.1.js'/>"></script>
		<script type="text/javascript"
			src="<c:url value='/scripts/ui/jquery.ui.core.js'/>"></script>
		<script type="text/javascript"
			src="<c:url value='/scripts/ui/jquery.ui.widget.js'/>"></script>
		<script type="text/javascript"
			src="<c:url value='/scripts/ui/jquery.ui.datepicker.js'/>"></script>
		<script type="text/javascript"
			src="<c:url value='/scripts/ui/i18n/jquery.ui.datepicker-zh-CN.js'/>"></script>
<script type="text/javascript">
    	
 
            
            $("#_begin").datepicker( $.datepicker.regional['zh-CN']);
			$("#_end").datepicker( $.datepicker.regional['zh-CN']);
        </script>
		<%@ include file="/jsp/front/common/footer.jsp"%>

	</body>
</html>